package com.ljh.account.service;

import com.ljh.account.dao.Account;
import com.ljh.account.mapper.AccountMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AccountService {

    @Autowired
    private AccountMapper accountMapper;

    public void createAccount(Account account) {
        accountMapper.insertAccount(account);
    }

    public Account findAccountById(Long id) {
        return accountMapper.getAccountById(id);
    }
    public Account findAccountByName(String name) {
        return accountMapper.getAccountByUsername(name);
    }

    public List<Account> findAllAccounts() {
        return accountMapper.getAllAccounts();
    }

    public void updateAccount(Account account) {
        accountMapper.updateAccount(account);
    }

    public void deleteAccount(Long id) {
        accountMapper.deleteAccount(id);
    }
}